using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using EIMS.Models.Enums;

namespace EIMS.Models
{
    /// <summary>
    /// 员工历史记录实体类
    /// </summary>
    public class EmployeeHistory
    {
        [Key]
        public int Id { get; set; }

        [Required]
        [Display(Name = "员工")]
        public int EmployeeId { get; set; }

        [Display(Name = "记录类型")]
        public HistoryType Type { get; set; }

        [Column(TypeName = "date")]
        [DataType(DataType.Date)]
        [Required(ErrorMessage = "生效日期不能为空")]
        [Display(Name = "生效日期")]
        public DateTime EffectiveDate { get; set; }

        [Display(Name = "原部门")]
        public int? OldDepartmentId { get; set; }

        [Display(Name = "新部门")]
        public int? NewDepartmentId { get; set; }

        [MaxLength(500, ErrorMessage = "备注不能超过500个字符")]
        [Display(Name = "备注")]
        public string Remarks { get; set; } = string.Empty;

        [Display(Name = "创建时间")]
        public DateTime CreatedAt { get; set; } = DateTime.Now;

        [Display(Name = "创建人")]
        public string CreatedBy { get; set; } = string.Empty;

        // 导航属性
        [ForeignKey("EmployeeId")]
        public virtual Employee? Employee { get; set; }

        [ForeignKey("OldDepartmentId")]
        public virtual Department? OldDepartment { get; set; }

        [ForeignKey("NewDepartmentId")]
        public virtual Department? NewDepartment { get; set; }
    }
} 